<?php
/**
 * Created by JetBrains PhpStorm.
 * User: shaoshuai
 * Date: 11-10-3
 * Time: PM3:49
 */
include_once 'paperblog.php';
checkLogin();
$navs = getNavs();
$settings = getSettings();
?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>导航管理</title>
    <link href="resources/css/common.css" rel="stylesheet" />
    <style>
        form {
            border-bottom: 1px dotted #999;
            padding: 3px;
            margin: 0;
        }
        form span {
            display: inline-block;
            width: 100px;
        }
        form span:nth-child(3) {
            width: 210px;
        }
        form span:first-child {
            width: 80px;
        }
        form input[type=text] {
            width: 90px;
            height: 22px;
            border: 1px solid #999;
        }
        form input[name=href] {
            width: 200px;
        }

        body > div:first-of-type {
            line-height: 2em;
        }
    </style>
</head>
<body>
    <div>博客地址：<?php echo $settings['base'] ?></div>
    <?php foreach ($navs as $id => $nav) { ?>
    <form action="action/nav.action.php" method="POST">
        <div><span><?php echo $id ?><input type="hidden" name="id" value="<?php echo $id ?>" /></span><span><input type="text" name="text" value="<?php echo $nav['text'] ?>" /></span><span><input type="text" name="href" value="<?php echo $nav['href'] ?>" /></span><span><input type="text" name="target" value="<?php echo $nav['target'] ?>" /></span><span><input type="submit" name="action" value="保存" /><input type="submit" name="action" value="删除" /></span></div>
    </form>
    <?php } ?>
    <form action="action/nav.action.php" method="POST">
        <div><span>添加导航</span><span><input type="text" name="text" /></span><span><input type="text" name="href" /></span><span><input type="text" name="target" /></span><span><input type="submit" name="action" value="添加" /></span></div>
    </form>
    <div style="padding: 10px;">
        <a href="index.php">返回管理主页</a>
    </div>
</body>
</html>
